package edu.gatech.volt2.drdoommgt.domain;

import java.util.ArrayList;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.hibernate.annotations.GenericGenerator;

/**
 * This class represents a Doctor's orders to be attached to the Treatment 
 * Record 
 * @author Khalen Morehead
 */
@Entity
@Table(name="doc_orders")
public class DocOrder 
{
	@Id
	@GeneratedValue(generator="increment")
	@GenericGenerator(name="increment", strategy = "increment")
	private long id; 
	private String followup;
	private String other;
	
	@ManyToMany(cascade = CascadeType.PERSIST)
    private List<Prescription> prescription;
	@ManyToMany(cascade = CascadeType.PERSIST)
	private List<Labwork> labwork;
	
	/**
	 * Default constructor
	 */
	public DocOrder()
	{
		this("N/A", "N/A", new ArrayList<Prescription>(), 
				new ArrayList<Labwork>());
	}
	
	/**
	 * Constructor for passed in objects
	 * 
	 * @param followup Info for the followup evaluation
	 * @param other Other pertinent information
	 * @param prescription Medecines prescribed to the patient
	 * @param labwork Labwork done
	 */
	public DocOrder(String followup, String other, 
			List<Prescription> prescription, List<Labwork> labwork)
	{
		this.followup=(followup==null ? "N/A" : followup);
		this.other=(other==null ? "N/A" : other);
		this.prescription=prescription;
		this.labwork=labwork;
	}

	/**
	 * Concatenates string of class info
	 * @return string of class info
	 */
	public String toString()
	{
		return "Followup: " + followup + "\nOther Comments: " + other + 
		"\nPrescriptions: " + prescription + "\nLabWork: " + labwork;
	}

	/**
	 * Followup getter
	 * @return followup Info for followup
	 */
	public String getFollowup()
	{
		return followup;
	}

	/**
	 * Followup setter
	 * @param followup Info for followup
	 */
	public void setFollowup(String followup)
	{
		this.followup=followup;
	}

	/**
	 * Other getter
	 * @return other Other info
	 */
	public String getOther()
	{
		return other;
	}

	/**
	 * Other setter
	 * @param other Other info
	 */
	public void setOther(String other)
	{
		this.other=other;
	}

	/**
	 * Prescription getter
	 * @return prescription List of prescriptions
	 */
	public List<Prescription> getPrescription()
	{
		return prescription;
	}

	/**
	 * Prescription setter
	 * @param prescription List of prescriptions
	 */
	public void setPrescription(List<Prescription> prescription)
	{
		this.prescription=prescription;
	}

	/**
	 * Labwork getter
	 * @return labwork List of labwork done
	 */
	
	public List<Labwork> getLabwork() {
		return labwork;
	}

	/**
	 * Labwork setter
	 * @param labwork List of labwork done
	 */
	public void setLabwork(List<Labwork> labwork) {
		this.labwork = labwork;
	}
}
